<template>
  <div class="shell" @click="changeBanner">
    <dl>
      <dt class="button" bannerIndex="1">猫</dt>
      <dt class="button" bannerIndex="2">广工</dt>
      <dt class="button" bannerIndex="3">华工</dt>
      <dt class="button" bannerIndex="4">家乡</dt>
      <dt class="button" bannerIndex="5">其他</dt>
    </dl>
  </div>
</template>

<script>
export default {
  name: "Nav",
  data() {
    return {
      bannerIndex: "",
    };
  },
  mounted() {},
  methods: {
    changeBanner(e) {
      this.bannerIndex = e.target.getAttribute("bannerIndex");
      //通知兄弟组件ListContaine和Floor：当前的索引值是哪个，以便右侧的轮播图和下面的floor数据保持同步
      this.$bus.$emit("changeIndex", this.bannerIndex);
    },
  },
};
</script>

<style lang="less" scoped>
.shell {
  float: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 120px;
  height: 300px;
  font-size: 20px;
  margin-left: 60px;
  margin-top: 10px;
  border-radius: 15px;
}
.button {
  width: 120px;
  height: 45px;
  line-height: 45px;
  text-align: center;
  margin: 10px;
  background-color: rgba(239, 240, 253,.2);
  transition: 0.3s;
  cursor: pointer;
}

.button:hover {
  background-color: rgba(188, 193, 247,.8);
}
</style>